package com.example.rabbitmq.sender;

import com.example.rabbitmq.common.bean.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * @description:
 * @author: luojm
 * @create: 2020-08-05 10:16
 */
@RestController
@RequestMapping("/sender")
public class SenderController {
    @Autowired
    private Sender sender;

    @GetMapping("/send")
    @ResponseBody
    public String testProvider(String name) {
        sender.send(new UserEntity(){{
            setName(name);
            setCreateTime(LocalDateTime.now());
            setSex(1);
        }});
        return name;
    }
}
